package homework;

public class HomeWork18 {
    public ListNode FindKthToTail(ListNode head,int k) {
        ListNode cur=head;
        int count=0;
        while (cur!=null){
            count++;
            cur=cur.next;
        }
        if(count<k||k==0){
            return null;
        }
        while (count-k!=0){
            count--;
            head=head.next;
        }
        return head;
    }
}
